"""
oneline_usage="$TODO_SH [-fhpantvV] [-d todo_config] action [task_number] [task_description]"

usage()
{
    cat <<-EndUsage
		Usage: $oneline_usage
		Try '$TODO_SH -h' for more information.
	EndUsage
    exit 1
}

shorthelp()
{
    cat <<-EndHelp
		  Usage: $oneline_usage

		  Actions:
		    add|a "THING I NEED TO DO +project @context"
		    addm "THINGS I NEED TO DO
		          MORE THINGS I NEED TO DO"
		    addto DEST "TEXT TO ADD"
		    append|app ITEM# "TEXT TO APPEND"
		    archive
		    command [ACTIONS]
		    deduplicate
		    del|rm ITEM# [TERM]
		    depri|dp ITEM#[, ITEM#, ITEM#, ...]
		    do ITEM#[, ITEM#, ITEM#, ...]
		    help
		    list|ls [TERM...]
		    listall|lsa [TERM...]
		    listaddons
		    listcon|lsc
		    listfile|lf [SRC [TERM...]]
		    listpri|lsp [PRIORITIES] [TERM...]
		    listproj|lsprj [TERM...]
		    move|mv ITEM# DEST [SRC]
		    prepend|prep ITEM# "TEXT TO PREPEND"
		    pri|p ITEM# PRIORITY
		    replace ITEM# "UPDATED TODO"
		    report
		    shorthelp

		  Actions can be added and overridden using scripts in the actions
		  directory.
	EndHelp

    # Only list the one-line usage from the add-on actions. This assumes that
    # add-ons use the same usage indentation structure as todo.sh.
    addonHelp | grep -e '^  Add-on Actions:' -e '^    [[:alpha:]]'

    cat <<-EndHelpFooter

		  See "help" for more details.
	EndHelpFooter
    exit 0
}

help()
{
    cat <<-EndOptionsHelp
		  Usage: $oneline_usage

		  Options:
		    -@
		        Hide context names in list output.  Use twice to show context
		        names (default).
		    -+
		        Hide project names in list output.  Use twice to show project
		        names (default).
		    -c
		        Color mode
		    -d CONFIG_FILE
		        Use a configuration file other than the default ~/.todo/config
		    -f
		        Forces actions without confirmation or interactive input
		    -h
		        Display a short help message; same as action "shorthelp"
		    -p
		        Plain mode turns off colors
		    -P
		        Hide priority labels in list output.  Use twice to show
		        priority labels (default).
		    -a
		        Don't auto-archive tasks automatically on completion
		    -A
		        Auto-archive tasks automatically on completion
		    -n
		        Don't preserve line numbers; automatically remove blank lines
		        on task deletion
		    -N
		        Preserve line numbers
		    -t
		        Prepend the current date to a task automatically
		        when it's added.
		    -T
		        Do not prepend the current date to a task automatically
		        when it's added.
		    -v
		        Verbose mode turns on confirmation messages
		    -vv
		        Extra verbose mode prints some debugging information and
		        additional help text
		    -V
		        Displays version, license and credits
		    -x
		        Disables TODOTXT_FINAL_FILTER

"""
import argparse


from libTodotxt import Task, Tasks


if __name__ == '__main__':

    parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                                     description='TODO.TXT Python Command Line Interface.')

    parser.add_argument('-@', action='store_false', dest='showContextNames',
                       help='Hide context names in list output.')
    parser.add_argument('-+', action='store_true', dest='showContextNames',
                        help='Hide context names in list output.')
    parser.add_argument('-c', action='store_true', dest='colorMode',
                        help='Color mode.')
    parser.add_argument('-d', dest='CONFIG_FILE',
                        default='~/.todo/config',
                        help='Use a configuration file other than the default ~/.todo/config')
    parser.add_argument('-f', action='store_true', dest='forceActions',
                        help='Forces actions without confirmation or interactive input.')
    parser.add_argument('-p', action='store_false', dest='colorMode', default=False,
                        help='Plain mode turns off colors.')
    parser.add_argument('-P', action='store_false', dest='showPriorityLabels',
                       help='Hide priority labels in list output.')
    parser.add_argument('-a', action='store_false', dest='autoArchive',
                        help="Don't auto-archive tasks automatically on completion")
    parser.add_argument('-A', action='store_true', dest='autoArchive',
                        help="Don't auto-archive tasks automatically on completion")
#    """
#		    -t
#		        Prepend the current date to a task automatically
#		        when it's added.
#		    -T
#		        Do not prepend the current date to a task automatically
#		        when it's added.
#		    -v
#		        Verbose mode turns on confirmation messages
#		    -vv
#		        Extra verbose mode prints some debugging information and
#		        additional help text
#		    -V
#		        Displays version, license and credits
#		    -x
#		        Disables TODOTXT_FINAL_FILTER
#    """

    parser.add_argument('action',
                       help='''action to perform
add|a "THING I NEED TO DO +project @context"
addm "THINGS I NEED TO DO
      MORE THINGS I NEED TO DO"
addto DEST "TEXT TO ADD"
append|app ITEM# "TEXT TO APPEND"
archive
command [ACTIONS]
deduplicate
del|rm ITEM# [TERM]
depri|dp ITEM#[, ITEM#, ITEM#, ...]
do ITEM#[, ITEM#, ITEM#, ...]
help
list|ls [TERM...]
listall|lsa [TERM...]
listaddons
listcon|lsc
listfile|lf [SRC [TERM...]]
listpri|lsp [PRIORITIES] [TERM...]
listproj|lsprj [TERM...]
move|mv ITEM# DEST [SRC]
prepend|prep ITEM# "TEXT TO PREPEND"
pri|p ITEM# PRIORITY
replace ITEM# "UPDATED TODO"
report
shorthelp''')
    parser.add_argument('task_number', help="")
    parser.add_argument('task_description', help="")
    args = parser.parse_args()